home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 March: Reference Library / Dev.CD Mar 97 RL.toast / mac / Technical Documentation / develop / develop Issue 27 / develop Issue 27 code / Internet Config Assistant / toolkit / CMultiDialogs.cp < prev    next >
Encoding:
Text File  |  1996-06-30  |  2.4 KB  |  108 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        CMultiDialogs.cp
  3.  
  4.     Contains:    Subclass of CDialogs which offer multiple pages
  5.  
  6.     Written by:    Arno Gourdol
  7.  
  8.     Copyright:    © 1996 by Apple Computer, Inc., all rights reserved.
  9. */
  10.  
  11. #include "CMultiDialogs.h"
  12. #include "assert.h"
  13.  
  14. #include <Resources.h>
  15.  
  16.  
  17.  
  18. // --------------------------------------------------------------------
  19. // CMultiDialog
  20. // --------------------------------------------------------------------
  21. // Constructor 
  22.  
  23. CMultiDialog::CMultiDialog(SInt16 dialogID, UInt16 commonItems, FontCode fontCode) :
  24.     fDialogPane(-1),
  25.     fCommonItems(commonItems),
  26.     CDialog(dialogID, fontCode)
  27. {
  28.  
  29. }
  30.  
  31.  
  32.  
  33. // --------------------------------------------------------------------
  34. // CMultiDialog
  35. // --------------------------------------------------------------------
  36. // Destructor 
  37.  
  38. CMultiDialog::~CMultiDialog(void)
  39. {
  40.  
  41. }
  42.  
  43.  
  44.  
  45. // --------------------------------------------------------------------
  46. // ItemHit
  47. // --------------------------------------------------------------------
  48. // Calls ItemHit(pane, itemHit) 
  49.  
  50. void CMultiDialog::ItemHit(short itemHit)
  51. {
  52.     ItemHit(GetDialogPane(), itemHit);
  53. }
  54.  
  55.  
  56.  
  57. // --------------------------------------------------------------------
  58. // ItemHit
  59. // --------------------------------------------------------------------
  60.  
  61. void CMultiDialog::ItemHit(UInt16 pane, short itemHit)
  62. {
  63. #pragma unused(pane, itemHit)
  64. }
  65.  
  66.  
  67.  
  68. // --------------------------------------------------------------------
  69. // SetDialogPane
  70. // --------------------------------------------------------------------
  71. // Switch to the designated pane.
  72. // Creates a dialog if none exist
  73. // Saves parameters from current pane
  74. // Prepare the items in the dialog, including parameter subsitution
  75.  
  76. void CMultiDialog::SetDialogPane(SInt16 pane)
  77. {
  78.     if (GetWindowRef() == NULL)
  79.         CreateWindow();
  80.     
  81.     if (GetDialogPane() != pane)
  82.     {
  83.         // Save parameters in current panel
  84.         for (int i = 0; i < kDialogParametersCount; i++)
  85.         {
  86.             if (fParameters[i].dialogItem != 0)
  87.                 GetItemText(fParameters[i].dialogItem, fParameters[i].value);
  88.         }
  89.         
  90.         // Remove items from current dialog
  91.         if (fDialogPane > 0)
  92.             ShortenDITL(GetDialogRef(),
  93.                          CountDITL(GetDialogRef()) - fCommonItems);
  94.         
  95.         fDialogPane = pane;
  96.         
  97.         {    
  98.             // Add new dialog items to the dialog
  99.             Handle items = GetResource('DITL', GetDialogPane());
  100.             assert(items != NULL);
  101.             AppendDITL(GetDialogRef(), items, overlayDITL);
  102.             ReleaseResource(items);
  103.         }
  104.             
  105.         // Prepare the items in the dialog
  106.         DoPrepareDialog();
  107.     }
  108. }